package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppPaymentOrder;

@Mapper
public interface AppPaymentOrderDao {

    @Select("select * from app_payment_order t where t.apppayid = #{id}")
    AppPaymentOrder getById(Long id);

    AppPaymentOrder getBylist(@Param("params") AppPaymentOrder appPaymentOrder);

    @Delete("delete from app_payment_order where id = #{id}")
    int delete(Long id);

    int update(AppPaymentOrder appPaymentOrder);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_payment_order(apppayid, paymentid, recipeno, hisregno, treatmentno, groupid, paystaus, unpayreason, payjsbz, deptcode1, deptcode2, recipettype, recipetdate, fee, tradeno, outtradeno, hostcode, patientid, times, cardno, cardtype, patientname, idcard, idcardtype) values(#{apppayid}, #{paymentid}, #{recipeno}, #{hisregno}, #{treatmentno}, #{groupid}, #{paystaus}, #{unpayreason}, #{payjsbz}, #{deptcode1}, #{deptcode2}, #{recipettype}, #{recipetdate}, #{fee}, #{tradeno}, #{outtradeno}, #{hostcode}, #{patientid}, #{times}, #{cardno}, #{cardtype}, #{patientname}, #{idcard}, #{idcardtype})")
    int save(AppPaymentOrder appPaymentOrder);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppPaymentOrder> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
